/**
 * 
 */
package de.gee.erep.shared.entities.citizen.details;

import de.gee.erep.shared.entities.citizen.CitizenDetail;
import de.gee.erep.shared.entities.citizen.CitizenDetailId;

public class CitizenShip implements CitizenDetail{
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "CitizenShip [id=" + id + ", regionId=" + regionId
				+ ", countryId=" + countryId + "]";
	}
	/***/
	private static final long serialVersionUID = 1L;
	
	CitizenDetailId id;
	int regionId;
	int countryId;
	private CitizenShip(){}
	public CitizenShip(CitizenDetailId id, int regionId, int countryId) {
		this.id = id;
		this.regionId = regionId;
		this.countryId = countryId;
	}
	/**
	 * @param detailId
	 */
	public CitizenShip(CitizenDetailId detailId) {
		this.id = detailId;
	}
	/* (non-Javadoc)
	 * @see de.gee.erep.shared.entities.citizen.CitizenDetail#getId()
	 */
	@Override
	public CitizenDetailId getId() {
		return id;
	}
	/**
	 * @param element
	 * @param data
	 */
	public void set(String element, String data) {
		try{
		if(element.equals("region")){
			regionId = Integer.valueOf(data);
		} else {
			countryId = Integer.valueOf(data);
		}
		} catch (NumberFormatException e){
			System.err.println("idNotSet");
		}
	}
}